//导航插入
var arrNav = [
  {
    name:"首页",
    Eng:"one",
    url:"",
    listpho:"",
    content:[]
  },
  {
    name:"周边游",
    url:"",
    Eng:"two",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"1日游",
        url:"",
        urlpho:"./images/public/new.gif"
      },
      {
        name:"2日游",
        url:"",
        urlpho:""
      },
      {
        name:"3日游",
        url:"",
        urlpho:""
      },
      {
        name:"黄龙岛",
        url:"",
        urlpho:""
      },
      {
        name:"武功山",
        url:"",
        urlpho:""
      }
    ]
  },
    {
    name:"当地玩乐",
    url:"",
    Eng:"three",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"City Walk",
        url:"",
        urlpho:""
      },
      {
        name:"旅拍写真民俗营地",
        url:"",
        urlpho:""
      },
      {
        name:"趣杭州·轻旅行",
        url:"",
        urlpho:""
      }
    ]
  },
    {
    name:"自由行",
    url:"",
    Eng:"four",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"酒店民宿",
        url:"",
        urlpho:""
      }
    ]
  },
    {
    name:"国内游",
    url:"",
    Eng:"five",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"广东",
        url:"",
        urlpho:""
      },
      {
        name:"云南",
        url:"",
        urlpho:""
      },
      {
        name:"广西",
        url:"",
        urlpho:""
      },
      {
        name:"贵州",
        url:"",
        urlpho:""
      },
      {
        name:"四川",
        url:"",
        urlpho:""
      },
      {
        name:"东北",
        url:"",
        urlpho:""
      },
      {
        name:"呼伦贝尔",
        url:"",
        urlpho:""
      },
      {
        name:"新疆",
        url:"",
        urlpho:""
      },
      {
        name:"河南",
        url:"",
        urlpho:""
      },
      {
        name:"西北",
        url:"",
        urlpho:""
      },
      {
        name:"西藏",
        url:"",
        urlpho:""
      },
      {
        name:"额济纳",
        url:"",
        urlpho:""
      },
      {
        name:"坝上",
        url:"",
        urlpho:""
      },
      {
        name:"湖南湖北",
        url:"",
        urlpho:""
      },
      {
        name:"秦晋",
        url:"",
        urlpho:""
      },
      {
        name:"华北",
        url:"",
        urlpho:""
      },
      {
        name:"海南",
        url:"",
        urlpho:""
      },
      {
        name:"甘南",
        url:"",
        urlpho:""
      }
    ]
  },
  {
    name:"出境游",
    url:"",
    Eng:"six",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"签证",
        url:"",
        urlpho:""
      },
      {
        name:"邮轮",
        url:"",
        urlpho:""
      },
      {
        name:"东南亚",
        url:"",
        urlpho:""
      },
      {
        name:"欧洲游",
        url:"",
        urlpho:""
      },
      {
        name:"美洲游",
        url:"",
        urlpho:""
      },
      {
        name:"澳新游",
        url:"",
        urlpho:""
      },
      {
        name:"中东非",
        url:"",
        urlpho:""
      },
      {
        name:"婆罗南亚",
        url:"",
        urlpho:""
      },
      {
        name:"日本",
        url:"",
        urlpho:""
      },
      {
        name:"全球海岛",
        url:"",
        urlpho:""
      },
      {
        name:"泰国",
        url:"",
        urlpho:""
      }
    ]
  },
    {
    name:"摄影游",
    url:"",
    Eng:"seven",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"摄影作品",
        url:"",
        urlpho:""
      },
      {
        name:"摄影线路",
        url:"",
        urlpho:""
      },
      {
        name:"摄影赛事",
        url:"",
        urlpho:""
      },
      {
        name:"摄影培训",
        url:"",
        urlpho:""
      },
      {
        name:"摄影人像",
        url:"",
        urlpho:""
      }
    ]
  },
    {
    name:"户外游",
    url:"",
    Eng:"eight",
    listpho:"./images/public/jiantouHei.png",
    content:[]
  },
    {
    name:"亲子游",
    url:"",
    Eng:"nine",
    listpho:"./images/public/jiantouHei.png",
    content:[]
  },
    {
    name:"赛事活动",
    url:"",
    Eng:"ten",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"丈量地球",
        url:"",
        urlpho:""
      }
    ]
  },
    {
    name:"主题游",
    url:"",
    Eng:"eleven",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"越野派",
        url:"",
        urlpho:""
      },
      {
        name:"瑜伽行",
        url:"",
        urlpho:""
      },
      {
        name:"全球徒步",
        url:"",
        urlpho:""
      },
      {
        name:"出境海岛",
        url:"",
        urlpho:""
      },
      {
        name:"海岛集",
        url:"",
        urlpho:""
      },
      {
        name:"房车游",
        url:"",
        urlpho:""
      },
      {
        name:"骑游天下",
        url:"",
        urlpho:""
      },
      {
        name:"沙漠旅行",
        url:"",
        urlpho:""
      }
    ]
  },
    {
    name:"定制游",
    url:"",
    Eng:"twelve",
    listpho:"./images/public/jiantouHei.png",
    content:[]
  },
    {
    name:"游记攻略",
    url:"",
    Eng:"thirteen",
    listpho:"./images/public/jiantouHei.png",
    content:[
      {
        name:"游记",
        url:"",
        urlpho:"./images/public/hot2.gif"
      },
      {
        name:"目的地",
        url:"",
        urlpho:""
      },
      {
        name:"攻略",
        url:"",
        urlpho:""
      },
      {
        name:"视频",
        url:"",
        urlpho:""
      },
      {
        name:"达人招募",
        url:"",
        urlpho:""
      },
      {
        name:"资讯",
        url:"",
        urlpho:""
      },
      {
        name:"问答",
        url:"",
        urlpho:""
      },
      {
        name:"领队",
        url:"",
        urlpho:""
      },
      {
        name:"游侠报道",
        url:"",
        urlpho:""
      }
    ]
  }
]
var arrCity = ["杭州站","上海站","广州站","成都站","北京站","武汉站","苏州站","南京站","重庆站","厦门站","深圳站","西安站"];
var arrType = ["综合","线路","签证","游记","攻略","视频","摄影","游侠"];

//搜索区
for(let x = 0;x<arrCity.length;x++){
  let c = $(
    `
      <li>${arrCity[x]}</li>
    `);
  $(".yeTou .sousuo .otherCity").append(c);
}
for(let x = 0;x<arrType.length;x++){
  let t =$(
    `
      <li><a>${arrType[x]}</a></li>
    `);
  $(".yeTou .sousuo .box .otherType").append(t);
}
$(".yeTou .sousuo .otherCity").on("click","li",function(){
  localStorage.setItem("city",$(this).text());
  let x = localStorage.getItem("city");
  $(".yeTou .sousuo .city").text(x);

})
$(".yeTou .sousuo .box .otherType").on("click","li a",function(){
  $(".yeTou .sousuo .box .type>div").text($(this).text());
})
//导航栏
for(let x = 0;x<arrNav.length;x++){
  let levelone =$(
    `
    <li class="levelone">
      <div class="box">
        <a href="" class="label ${arrNav[x].Eng}">${arrNav[x].name}</a>
      </div>
    </li>
    `);
  $(".yeTou .navList>ul").append(levelone);
  if(arrNav[x].content.length !=0){
    let ul =$(
      `
        <ul class="list"></ul>
      `)
    $(`.yeTou .navList .${arrNav[x].Eng}`).parent().append(ul);
    ul.prev().css("background-image",`url(${arrNav[x].listpho})`);
  }
  for(let y=0;y<arrNav[x].content.length;y++){
    let leveltwo = $(
      `
      <li class="leveltwo"><a href="">${arrNav[x].content[y].name}</a></li>
      `);
    $(`.yeTou .navList .${arrNav[x].Eng}`).next().append(leveltwo);
    if(arrNav[x].content[y].urlpho){
      let img = $(
        `
          <img src="${arrNav[x].content[y].urlpho}"" alt="">
        `);
      $(`.yeTou .navList .${arrNav[x].Eng}`).next().find("a").append(img);
    }
  }
  if(arrNav[x].content.length>6 && arrNav[x].content.length<=12){
    $(`.yeTou .navList .${arrNav[x].Eng}`).next().css("width","180px")
  }
  if(arrNav[x].content.length>12){
    $(`.yeTou .navList .${arrNav[x].Eng}`).next().css("width","250px")
  }
}
//变色设置
window.onload = function(){
  var leveltwo =$(".yeTou .navList .levelone>.box>ul>.leveltwo");
  leveltwo.on("mouseenter",function(){
    leveltwo.removeClass("hov");
    $(this).addClass("hov");
  });
  leveltwo.on("mouseleave",function(){
    $(this).removeClass("hov");
  });
}
